Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record transaction fees #10715

Merged
merged 6 commits into from
Dec 17, 2024
Merged

record transaction fees #10715

merged 6 commits into from
Dec 17, 2024

Conversation

turadg
Copy link
Member

@turadg turadg commented Dec 17, 2024

closes: #10578

Description

Adds the fee split to the Disbursed status of TransactionRecord.

Also updates tests to have a marshaller that is capable of marshaling brands in the split.

Security Considerations

Gives a read-only marshaller to StatusManager.

Scaling Considerations

a little more data recorded on disbursement. Since that's a terminal state it will be retained until the GC action is run in a core-eval (or we are able to delete upon completion)

Documentation Considerations

updated types

Testing Considerations

CI

Upgrade Considerations

not deployed

Copy link

cloudflare-workers-and-pages bot commented Dec 17, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8846972
Status: ✅  Deploy successful!
Preview URL: https://384258a6.agoric-sdk.pages.dev
Branch Preview URL: https://10578-transaction-fees.agoric-sdk.pages.dev

View logs

@turadg turadg marked this pull request as ready for review December 17, 2024 17:45
@turadg turadg requested a review from a team as a code owner December 17, 2024 17:45
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good

I'm a little uncertain on a couple things...

zone.subZone('status-manager'),
t.context.txnsNode,
);
const { statusManager } = t.context;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statusManager is not stateless, so sharing it across tests is surprising. Consider adding a comment to say that this is done on purpose and why.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's constructed in beforeEach so it's not shared across tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah. beforeEach. I missed that. cool.


const capData = await E(marshaller).toCapData(record);

await E(txNode).setValue(JSON.stringify(capData));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why await the setValue?

I'm fuzzy on our void vs await conventions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function has to be async to get capData before stringifying it.

this final await is just to provide the option to the caller to await that part. All the consumers use void now but voiding here wouldn't change the need for that.

@@ -164,7 +162,7 @@ export const prepareStatusManager = (
publishEvidence(txHash, evidence);
if (status !== PendingTxStatus.Observed) {
// publishEvidence publishes Observed
publishStatus(txHash, status);
void publishTxnRecord(txHash, harden({ status }));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does void mean "I'm certain this never rejects" or "if it rejects, there's nothing useful I can do, so I might as well let standard unhandled rejection logging do its thing"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the latter

storedCompletedTxs.add(txId);
}

const capData = await E(marshaller).toCapData(record);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side note: This adds a round-trip to the board vat; I'm curious whether it has a noticeable / measurable performance impact. Here's hoping I/we measure that in...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@@ -40,6 +41,7 @@ export interface CctpTxEvidence {
*/
export interface TransactionRecord extends CopyRecord {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type could be more precise. It could be a union that requires evidence in OBSERVED and split in DISBURSED.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be. I went this way to maintain the option to include these any time.

@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Dec 17, 2024
@turadg turadg force-pushed the 10578-transaction-fees branch from f27f72f to 8846972 Compare December 17, 2024 18:48
@mergify mergify bot merged commit 9418efc into master Dec 17, 2024
81 checks passed
@mergify mergify bot deleted the 10578-transaction-fees branch December 17, 2024 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Record FastUSDC fees collected to vstorage
2 participants